#!/usr/bin/env python
as = [1..999]
bs = [1..999]
result = ''

for a in as:
  for b in as:
    result = string(a * b)
    if result[0] == result[5] &&  result[1] == result[4] &&  result[2] == result[3]:
      print result 
  
